using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Door : MonoBehaviour
{
    //检测碰撞 玩家死亡
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.layer == LayerMask.NameToLayer("Player"))
        {
            Debug.Log("门");
            Debug.Log(GameApp.instance.enemyCount);
            Debug.Log(GameApp.instance.deathEnemyCount);
            //TODO判断是否消除所有怪物
            if (GameApp.instance.enemyCount <= GameApp.instance.deathEnemyCount)
            {
                GameApp.instance.level++;//关卡数+1
                GameApp.instance.enemyCount++;//敌人数+1
                //过关
                MapController.instance.Init();
                //弹窗
                UIManager.Instance.ShowTip("第" + GameApp.instance.level + "关", Color.blue);
                GameApp.instance.enemyMove = true;
                //重置消灭敌人数量
                GameApp.instance.deathEnemyCount = 0;
            }

        }
    }
}
